const path = require('path');
module.exports = function () {
  const pwd = process.env.PWD;
  const config = {
    src: 'src/',
    app: 'public/app/',
    themes: 'themes/',
  };
  Object.assign(config, {
    scss: {
      desktop: `${config.src}desktop/scss/`,
      site: `${config.src}site/scss/`,
      b2c: `${config.src}b2c/scss/`,
      theme: `${config.src}themes/default/scss/`,
    },
    img: {
      desktop: `${config.src}desktop/images/`,
      site: `${config.src}site/images/`,
      b2c: `${config.src}b2c/images/`,
      theme: `${config.src}themes/default/images/`,
    },
    dist: {
      desktop: `${config.app}desktop/statics/`,
      site: `${config.app}site/statics/`,
      b2c: `${config.app}b2c/statics/`,
      theme: `${config.themes}default/`,
    },
  });

  Object.assign(config, {
    desktop: {
      css: `${ config.dist.desktop }css/`,
      js: `${ config.dist.desktop }js/`,
      js_mini: `${ config.dist.desktop }js_mini/`,
      img: `${ config.dist.desktop }stylesheets/default/images/`
    },
    site: {
      css: `${ config.dist.site }css/`,
      js: `${ config.dist.site }js/`,
      img: `${ config.dist.site }images/`
    },
    b2c: {
      css: `${ config.dist.b2c }css/`,
      js: `${ config.dist.b2c }js/`,
      img: `${ config.dist.b2c }images/`
    },
    theme: {
      css: `${ config.dist.theme }images/`,
      js: `${ config.dist.theme }images/`,
      img: `${ config.dist.theme }images/`,
      page: `${ config.dist.theme }`,
    },
  });

  Object.assign(config.desktop, {
    minCssFiles: [
      `${config.desktop.css}default/login.css`,
      `${config.desktop.css}default/singlepage.css`
    ],
    concatCssFiles: [
      {
        files: [
          `${config.desktop.css}framework.css`,
          `${config.desktop.css}default/style.css`,
        ],
        concats: 'style_min.css',
        dest: `${ config.desktop.css }default`,
      },
    ],
    minJsFiles: [
      `${config.desktop.js}coms/autocompleter.js`,
      `${config.desktop.js}coms/cmdrunner.js`,
      `${config.desktop.js}coms/finder.js`,
      `${config.desktop.js}coms/highcharts.js`,
      `${config.desktop.js}coms/hst.js`,
      `${config.desktop.js}coms/md5.js`,
      `${config.desktop.js}coms/modedialog.js`,
      `${config.desktop.js}coms/pager.js`,
      `${config.desktop.js}coms/uploader.js`,
    ],
    concatJsFiles: [
      {
        files: [
          `${config.desktop.js}loader.js`,
        ],
        concats: 'loader.js',
        dest: `${ config.desktop.js_mini }`,
      },
      {
        files: [
          `${config.desktop.js}fixie6.js`,
        ],
        concats: 'fixie6.js',
        dest: `${ config.desktop.js_mini }`,
      },
      {
        files: [
          `${config.desktop.js}moo.js`,
          `${config.desktop.js}moomore.js`,
          `${config.desktop.js}mooadapter.js`,
          `${config.desktop.js}jstools.js`,
        ],
        concats: 'moo_min.js',
        dest: `${ config.desktop.js_mini }`,
      },
      {
        files: [
          `${config.desktop.js}coms/messagebox.js`,
          `${config.desktop.js}coms/dialog.js`,
          `${config.desktop.js}coms/validate.js`,
          `${config.desktop.js}coms/wpage.js`,
          `${config.desktop.js}coms/dropmenu.js`,
        ],
        concats: 'tools_min.js',
        dest: `${ config.desktop.js_mini }`,
      },
      {
        files: [
          `${config.desktop.js}coms/colorpicker.js`,
          `${config.desktop.js}coms/datapicker.js`,
        ],
        concats: 'datapicker.js',
        dest: `${ config.desktop.js_mini }coms`,
      },
      {
        files: [
          `${config.desktop.js}editor_style_1.js`,
          `${config.desktop.js}editor.js`,
        ],
        concats: 'editor.js',
        dest: `${ config.desktop.js_mini }coms`,
      },
    ],
  });

  return config;
};
